package com.usian.admin.controller;

import com.usian.admin.AdChannelControllerApi;
import com.usian.admin.AdSensitiveControllerApi;
import com.usian.admin.service.AdChannelService;
import com.usian.admin.service.AdSensitiveService;
import com.usian.model.admin.dtos.ChannelDto;
import com.usian.model.admin.dtos.SensitiveDto;
import com.usian.model.admin.pojos.AdChannel;
import com.usian.model.admin.pojos.AdSensitive;
import com.usian.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/sensitive")
public class AdSensitiveController implements AdSensitiveControllerApi {

    @Autowired
    private AdSensitiveService adSensitiveService;

    /**
     * 频道列表查询
     * @param dto
     * @return
     */

    @RequestMapping("/list")
    @Override
    public ResponseResult findPage(@RequestBody SensitiveDto dto) {
        ResponseResult page = adSensitiveService.findPage(dto);
        return page;
    }

    /**
     * 频道列表添加
     * @param adSensitive
     * @return
     */

    @PostMapping("/save")
    @Override
    public ResponseResult insertChannel(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.insertChannel(adSensitive);
    }

    /**
     * 频道修改
     * @param adSensitive
     * @return
     */

    @PostMapping("/update")
    @Override
    public ResponseResult updateChannel(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.updateChannel(adSensitive);
    }

    /**
     * 频道删除
     * @param id
     * @return
     */

    @DeleteMapping("/del/{id}")
    @Override
    public ResponseResult deleteById(@PathVariable Integer id) {
        return adSensitiveService.deleteById(id);
    }
}
